package com.pawn.exceptiondemo.utils;


import java.util.HashMap;

/**
 * @program: JAVA-EE
 * @description:
 * @author: Dawson.Zhang
 * @create: 2020-09-08
 **/
public class ResUtil extends HashMap {
    public static ResUtil SUCCESS(ResCode resCode, Object object){
        ResUtil resUtil = new ResUtil();
        resUtil.put("code",resCode.getCode());
        resUtil.put("msg",resCode.getMsg());
        resUtil.put("data",object);
        return resUtil;
    }
    public static ResUtil FAILED(ResCode resCode){
        ResUtil resUtil = new ResUtil();
        resUtil.put("code",resCode.getCode());
        resUtil.put("msg",resCode.getMsg());
        resUtil.put("data",null);
        return resUtil;
    }
    public static ResUtil FAILED(Integer code,String msg){
        ResUtil resUtil = new ResUtil();
        resUtil.put("code",code);
        resUtil.put("msg",msg);
        resUtil.put("data",null);
        return resUtil;
    }
}
